﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MBT.Modeling
{
    /// <summary>
    /// This is the attribute of classes that their corresponding object is a DES model
    /// </summary>
    [System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple = false)]
    public class ModelClass : Attribute
    {
        string id;
        public string ID
        {
            get
            {
                return id;
            }
        }
        public ModelClass(string modelID)
        {
            this.id = modelID;
        }
    }


    [System.AttributeUsage(System.AttributeTargets.Field, AllowMultiple = false)]
    public class ReferenceModel : Attribute
    {
        string id;
        public string ID
        {
            get
            {
                return id;
            }
        }
        public ReferenceModel(string modelID)
        {
            this.id = modelID;
        }
    }


    [System.AttributeUsage(System.AttributeTargets.Field, AllowMultiple = false)]
    public class SubModel : Attribute
    {
        string id;
        public string ID
        {
            get
            {
                return id;
            }
        }
        public SubModel(string modelID)
        {
            this.id = modelID;
        }
    }


    /// <summary>
    /// This is the group of attributes for state variables and their related methods
    /// </summary>
    public class EnGineVariables
    {
        /// <summary>
        /// A boolean method that shows the current valuation of state variables is related to a final (accepted) state or not.
        /// </summary>
        [System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple = false)]
        public class FinalStateCondition : Attribute
        {

        }

        /// <summary>
        /// A boolean method that shows the current valuation of state variables is a valid valuation (OK) or not (runtime error)
        /// </summary>
        [System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple = false)]
        public class ValidStateCondition : Attribute
        {

        }

        /// <summary>
        /// A boolean method that shows the current valuation of state variables should be considered as a state or should be skipped
        /// </summary>
        [System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple = false)]
        public class SkipStateCondition : Attribute
        {

        }

        [System.AttributeUsage(System.AttributeTargets.Parameter, AllowMultiple = false)]
        public class Exclude : Attribute
        {
            string id;
            public string DomainID
            {
                get
                {
                    return id;
                }
            }
            public Exclude(string ID)
            {
                this.id = ID;
            }
        }

    }



    /// <summary>
    /// 
    /// </summary>
    [System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple = false)]
    public class SkipTransitionCondition : Attribute
    {
        string id;
        public string transitionID
        {
            get
            {
                return id;
            }
        }
        public SkipTransitionCondition(string actionID)
        {
            this.id = actionID;
        }
    }

    /// <summary>
    /// 
    /// </summary>
    [System.AttributeUsage(System.AttributeTargets.Parameter, AllowMultiple = false)]
    public class Domain : Attribute
    {
        string id;
        public string DomainID
        {
            get
            {
                return id;
            }
        }
        public Domain(string ID)
        {
            this.id = ID;
        }
    }


    [System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Field, AllowMultiple = false)]
    public class DomainDef : Attribute
    {
        string id;
        public string DomainID
        {
            get
            {
                return id;
            }
        }
        public DomainDef(string ID)
        {
            this.id = ID;
        }
    }

    /// <summary>
    /// Type of action: controllable action vs observable event
    /// </summary>
    public enum ActionType
    {
        /// <summary>
        /// 
        /// </summary>
        controllable,
        /// <summary>
        /// 
        /// </summary>
        observable
    };

    /// <summary>
    /// 
    /// </summary>
    public class ActionAttrib
    {

        /// <summary>
        /// 
        /// </summary>
        [System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple = false)]
        public class Exec : Attribute
        {
            string id;
            readonly ActionType type;
            public bool isControllable
            {
                get
                {
                    if (type == ActionType.controllable)
                        return true;
                    return false;
                }
            }
            public string actionID
            {
                get
                {
                    return id;
                }
            }
            public Exec(string actionID, ActionType type = ActionType.controllable)
            {
                this.type = type;
                this.id = actionID;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        [System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple = false)]
        public class Pre : Attribute
        {
            string id;
            public string actionID
            {
                get
                {
                    return id;
                }
            }
            public Pre(string actionID)
            {
                this.id = actionID;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        [System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple = false)]
        public class Weight : Attribute
        {
            string id;
            public string actionID
            {
                get
                {
                    return id;
                }
            }
            public Weight(string actionID)
            {
                this.id = actionID;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        [System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple = false)]
        public class Rank : Attribute
        {
            string id;

            public string actionID
            {
                get
                {
                    return id;
                }
            }
            public Rank(string actionID)
            {

                this.id = actionID;
            }
        }

    }
}
